<?php $view->extend('::layout.html.php') ?>

<?php $view['slots']->start('_content') ?>
<div class="contenu">
<?php echo $view->render(
            'LEAUserBundle:Default:respMenu.html.php',
            array('user' => $user,
					 'refYear' => $refYear,
					 'arrayProf' => $arrayProf,
					 'arraySecr' => $arraySecr,
					 'arrayResp' => $arrayResp,
					 'menuProf' => $menuProf,
					 'menuSecr' => $menuSecr,
					 'menuResp' => $menuResp)
        ) ?>

 <div id="cadre_0" class="contenu-item2 on">
   <br/>
		<?php echo $view['form']->widget($listeSituationEtu);
		 //echo $view['form']->widget($listeTuteur);
		 echo $view['form']->widget($listeFormation);
	?>
	<form id="choixEtudiantsForm" method="POST">
		<h2>Informations sur les étudiants</h2>
		<?php
		$row = $listeEtud->fetch() ;
		if (sizeof($listeEtud) == 0)
			die("problem query for retrieving students! No student found!");
		?>
		- cochez les cases des étudiants qui vous intéressent, puis transmettez vos choix.
		<!--input type="submit" value="Transmettre choix"/-->
		<br/><br/>
		<div class="container-fluid">
			<table id="tableau_triable" class="tablesorter" border="0" cellpadding="1" cellspacing="1">
			<thead><tr class="hidden-xs">
					<th></th>
					<th>Nom</th>
					<th>Prenom</th>
					<th>Formation</th>
					<th>Ville / Kilométrage</th>
					<th>Entreprise</th>
					<th>Tuteur (potentiels)</th>
					<th></th>
				</tr><tr class="visible-xs">
					<th></th>
					<th>Nom</th>
					<th>Prenom</th>
					<th>Formation</th>
				</tr><tr class="visible-xs">
					<th></th>
					<th>Ville / Kilométrage</th>
					<th>Entreprise</th>
					<th>Tuteur (potentiels)</th>
				</tr>
			</thead>
			<tbody>
<?php
$cmptEtud = 0;


while($row = $listeEtud->fetch()){
	$mailResp =$row['mail_resp_form'] ;
  /*  if ($mailResp)
        echo ",", $mailResp;
    echo "'/>";


    $tuteur = null;
    $tuteurString = $row[15] ? "<b>" . $row[15] . "</b>" : null;

    if ((strcmp($row[15], "aucun") != 0) && ($sansTuteur == "EXCL" || $sansTuteur == "NON"))
        continue;

    if ((($tuteurs && mysql_num_rows($tuteurs) > 0) || (strcmp($row[15], "aucun") != 0)) && $sansTuteur == "NON")
        continue;

    $entr = $row[9];
    //echo "entreprise:".$entr;
    if (($entr === "__sans entreprise__") && ($sansTuteur === "ENTR"))
        continue;

    if ($tuteurs)
        $tuteur = mysql_fetch_row($tuteurs);

    $tuteurPot = "(";
    while ($tuteur) {
        if (strcmp($tuteur[0], "nouveau") != 0)
            $tuteurPot.=" " . $tuteur[0];
        else
            $tuteurPot.=" " . $tuteur[1] . "_" . $tuteur[2];
        $tuteur = mysql_fetch_row($tuteurs);
    }
    $tuteurPot.=" )";

    if ($tuteurPot !== "( )") {
        //$tuteurString.=" ".$tuteurPot;
        $nbTutPot = (substr_count($tuteurPot, ' ') - 1);
        $tuteurString.=" ( " . $nbTutPot;
        //if ($nbTutPot>1)
        //  $tuteurString.="s";
        $tuteurString.=" )";
        if (strchr($tuteurPot, $_SESSION[CK_USER])) {
            $tuteurString.="<br/> dont vous-même";
        }
    } else {
        $tuteurString.=" (aucun)";
    }
    if ($row['tuteurRef'] != 'aucun')
        echo "<tr bgcolor=\"gray\">";
    else*/
    echo "<tr class='hidden-xs'>";
    echo "<td>
			<input type='checkbox' name='selection[]' value='", $cmptEtud, "'/>
          </td>";

    echo "<td>", $row['nom'], "</td>";
    echo "<td>", $row['prenom'], "</td>";
    echo "<td>", $row['formation'], "</td>";

// modification pour avoir la distance avec la ville

    echo "<td>", $row['ville'], "</td>";

           // "<input type='button' value='Itineraire' onClick='window.location.href ='".$Distance->getLien($row[6])."'/>" ,
            //,"<a href='".$Distance->getLien($row[24]." ".$row[25]." ".$row[6])."' target='_blank'>$row[23] km</a> ",

//Fin modif
    echo "<td>", substr($row['entreprise'],0,20), "</td>";
    echo "<td align='center'>", "tut potentiel", "</td>";
    /*echo "<td>" . $row['motscles'] . " <div id='td", $i, "' style='visibility:hidden'><a name=\"#", $i, "\"/>";
    echo "<div style='top:30%;left:15%;width:60%;border:3px solid black;background-color:rgba(100,100,100,1);'>";
    echo "<table border='1' bgcolor='#aaaaaa'>";
    echo "<tr><td>Referent</td>", "<td>", $row['referent'], "</td></tr>";
    echo "<tr><td>Missions</td>", "<td>", $row['mission'], "</td></tr>";
    echo "<tr><td>Services</td>", "<td>", $row['service'], "</td></tr>";
    echo "<tr><td>Clients</td>", "<td>", $row['client'], "</td></tr>";
    echo "<tr><td>Envirnmnt Tech.</td>", "<td>", $row['env'], "</td></tr>";
    echo "</table><input type='button' value='Cacher'></div>";*/
    echo "<td><a href='#'>détails</a></td>";
    echo "</tr>";




	echo "<tr class='visible-xs lc' style='border:1px solid white'>";
    echo "<td class='small'>
			<input type='checkbox' name='selection[]' value='", $cmptEtud, "'/>
          </td>";
$cmptEtud++;
    echo "<td class='small'>", $row['nom'], "<input type='hidden' name='et_pn[]' value='" . $row['prenom'] . " " . $row['nom'] . "'/></td>";
    echo "<td class='small'>", $row['prenom'], "</td>";
    echo "<td class='small'>", $row['formation'],"</td>";

	echo "</tr><tr class='visible-xs lc' >";
	echo "<td></td>";
    echo "<td class='small'>", $row['ville'], "</td>\n";
//Fin modif
    echo "<td class='small'>", substr($row['entreprise'],0,20), "</td>";
    echo "<td class='small'>&nbsp;", "tut potentiel", "</td>";
    echo "</tr></div>";
}

?>
                </tbody>
            </table>
            </div>
            <br/>
            <input type="submit" value="Transmettre choix"/>


        </form>
     </div>
     </div>